package Generator;

import com.baomidou.mybatisplus.annotations.IdType;
import com.baomidou.mybatisplus.generator.AutoGenerator;
import com.baomidou.mybatisplus.generator.ConfigGenerator;

public class EntityGenerator {
    public static void main(String[] args) {
        ConfigGenerator cg = new ConfigGenerator();
        // 配置 MySQL 连接
        cg.setDbDriverName("com.mysql.jdbc.Driver");
        cg.setDbUser("root");
        cg.setDbPassword("root");
        cg.setDbUrl("jdbc:mysql://144.168.62.63:3306/sd?characterEncoding=utf8");
        // 配置包名
        cg.setEntityPackage("com.attendance.model");
        cg.setMapperPackage("com.attendance.mapper");
        cg.setServicePackage("com.attendance.service");
        cg.setXmlPackage("com.attendance.mapper.xml");
        cg.setServiceImplPackage("com.attendance.service.impl");

        // 配置表主键策略
        cg.setIdType(IdType.AUTO);

        // 配置保存路径
        cg.setSaveDir("E:\\Users\\OPTIPLEX\\Documents\\Codes\\Attendency\\src\\main\\java\\");
        // 其他参数请根据上面的参数说明自行配置，当所有配置完善后，运行AutoGenerator.run()方法生成Code
        // 生成代码
        AutoGenerator.run(cg);
    }
}
